<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>5.6.1.绑定class样式</title>
</head>
<body>
    <div id="app">
        <!--数组语法-->
        <div v-bind:class="activeClass"></div>
        <div v-bind:class="errorClass"></div>
        <div v-bind:class="[activeClass,errorClass]"></div>
        <!--对象语法写法一：-->
        <!--CSS 属性名可以用驼峰式 (camelCase) 或短横线分隔 (kebab-case，记得用单引号括起来) 来命名-->
        <div class="static" v-bind:class="{active:isActive,'text-danger':hasError}"></div>
        <!--对象语法写法二：-->
        <!--通常情况下，绑定的数据对象不必内联定义在模板里：-->
        <div class="static" v-bind:class="classObject"></div>
    </div>


    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script type="text/javascript">
        var app = new Vue({
            el:"#app",
            data:{
                activeClass:"active",
                errorClass:['text-danger','text-error'],
                isActive:true,
                hasError:true,
                classObject:{
                    active:true,
                    'text-danger':true
                }
            }
        });

    </script>
</body>
</html>